# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=ayatana-indicator-power
pkgver=22.2.0
pkgrel=0
pkgdesc="Ayatana Indicator Power Applet"
url="https://github.com/AyatanaIndicators/ayatana-indicator-power"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	dbus-test-runner-dev
	glib-dev
	gtest-dev
	intltool
	libayatana-common-dev
	libnotify-dev
	"
checkdepends="dbus dbus-test-runner"
subpackages="$pkgname-lang"
source="https://github.com/AyatanaIndicators/ayatana-indicator-power/archive/$pkgver/ayatana-indicator-power-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build -j 1
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1ba2a3135b5bc21f08ff79cbb4cdb44f613a145d966448cdcacd2ad962be275b12d0d4b1a36abea7052510d9e774051ff0b730644acf9c0ebc2e69017f3803c3  ayatana-indicator-power-22.2.0.tar.gz
"
